package com.bzzoneit.newsys.entity.admin;

import java.io.Serializable;
import java.util.List;

public class Menu implements Serializable,Comparable{
	
	private static final long serialVersionUID = -2726709540069876682L;
	
	private Long id;
	private Long parent_id;
	private String name;
	private String image;
	private String url;
	private String qtip;
	private Integer sortNum;
	private String description;
	private String navtabid;
	private boolean checked;
	private String treestring;
	
	public String getTreestring() {
		return treestring;
	}
	public void setTreestring(String treestring) {
		this.treestring = treestring;
	}

	public boolean isChecked() {
		return checked;
	}
	public void setChecked(boolean checked) {
		this.checked = checked;
	}
	public String getNavtabid() {
		return navtabid;
	}
	public void setNavtabid(String navtabid) {
		this.navtabid = navtabid;
	}
	/**
	 * true:默认为叶子结点，即子菜单
	 */
	private boolean leaf = true;
	private List<Menu> children;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getParent_id() {
		return parent_id;
	}
	public void setParent_id(Long parent_id) {
		this.parent_id = parent_id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getQtip() {
		return qtip;
	}
	public void setQtip(String qtip) {
		this.qtip = qtip;
	}
	public Integer getSortNum() {
		return sortNum;
	}
	public void setSortNum(Integer sortNum) {
		this.sortNum = sortNum;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public boolean isLeaf() {
		return leaf;
	}
	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}
	public List<Menu> getChildren() {
		return children;
	}
	public void setChildren(List<Menu> children) {
		this.children = children;
	}
	
	public int compareTo(Object o) {
		Menu other =(Menu)o; 
		//根据pid
		if(this.parent_id>other.parent_id){
			return 1;
		}
		if(this.parent_id<other.parent_id){
			return -1;
		}
		//再根据sort
		if(this.sortNum>other.sortNum){
			return 1;
		}
		if(this.sortNum<other.sortNum){
			return -1;
		}
		return 0;
	}
	@Override
	public String toString() {
		return "Menu [id=" + id + ", parent_id=" + parent_id + ", name=" + name
				+ ", image=" + image + ", url=" + url + ", qtip=" + qtip
				+ ", sortNum=" + sortNum + ", description=" + description
				+ ", navtabid=" + navtabid + ", checked=" + checked + ", leaf="
				+ leaf + ", children=" + children + "]";
	}
	
	
}
